import axiosInstance from '@/utils/request'
import { IRecordToken, IRecordMsg, IRecordFile, IRecordTokenResponse, IRecordMsgResponse } from '@/types/type'

export const getParseRecordToken = (params: IRecordToken): Promise<IRecordTokenResponse> => {
  return axiosInstance.request({
    baseURL: 'http://10.254.39.228:8063/baiduopenapi/oauth/2.0/token',
    method: 'post',
    params
  })
}

export const getParseRecordMsg = (params: IRecordMsg, data: IRecordFile): Promise<IRecordMsgResponse> => {
  return axiosInstance.request({
    baseURL: 'http://10.254.39.228:8063/baiduvop/server_api',
    method: 'post',
    params,
    data,
    headers: {
      'Content-Type': 'audio/pcm;rate=16000'
    }
  })
}
